<?php
if (!class_exists('Connection')) {
	require_once '../mdl/Connection.php';
}
class SelectCompany extends Connection{
	private $conn;

	public function __construct(){
		Connection::init();
		$this->conn = $this->getConnection();
	}
	public  function checkName($name){
		$stmt = $this->conn->prepare("	select count(id)
										from company
										where name =  ?");
		$stmt->bindValue(1, $name);
		$stmt->execute();
		return $stmt->fetchColumn();
	}

	public function extractCompany($id){
		$stmt      = $this->conn->prepare("	select *
												from company
												where id =  ? ");
		$stmt->bindValue(1, $id, PDO::PARAM_INT);
		$stmt->execute();
		return  $stmt->fetchAll(PDO::FETCH_ASSOC);
	}

}


?>